var DynLayerManager = {
    addUploadAndDownloadMarker: function (map) {
        //该方法用于添加顶标不管上传下载

        map.addSource("singlePointIntoAir", {
            'type': 'vector',
            'tiles': ['http://datahive.minedata.cn:48085/test/SignPoint/{z}/{x}/{y}']
        })

        map.addLayer({
            "type": "symbol",
            "source": 'singlePointIntoAir',
            "source-layer": "SignPoint",
            "id": 'uploadAndDownMarker',
            "layout": {
                "icon-image": {
                    "type": "categorical",
                    "property": "carid",
                    "stops": [
                        // "temperature" is 0   -> circle color will be blue
                        ["10001", 'shihua-up'],
                        ['10002', 'shihua-up'],
                        ['10003', 'shihua-up'],
                        ['10004', 'shihua-down'],
                        ['10005', 'shihua-down'],
                        ['20001', 'shigu-down'],
                        ['20002', 'shigu-down'],
                        ['30001', 'paomao-down'],
                        ['30002', 'paomao-down']
                    ]
                },
                "icon-allow-overlap": true,
                "icon-ignore-placement": true,
                "symbol-avoid-edges": false
            },
            "paint": {
                "render-road-mark": true,
                "render-3d": true,
                "symbol-height-offset": 50,
                "static-up": false
            },
            'minzoom': 17

        });

        map.addLayer({
            "id": "staticploadAndDownMarker",
            "type": "symbol",
            "source": "myEventSource",
            "layout": {
                //"symbol-placement": "line",
                "icon-image": {
                    "type": "categorical",
                    "property": "icon",
                    "stops": [
                        // "temperature" is 0   -> circle color will be blue
                        ["near-shigux3", 'shigu-up'],
                        ['near-paomaox3', 'paomao-up']
                    ]
                },
                "icon-allow-overlap": true,  //图标允许压盖
            },
            "paint": {
                "render-3d": true,
                "render-road-mark": true,
                "symbol-height-offset": 53
            },
            filter: ["==", 'type', 0],
            'minzoom': 17
        });
    },
    addIntoAirMarker: function (map) {
        //添加能够飞上天的传感器信息图片
        var iconOffset = [128, 0];
        //上天marker1
        map.addLayer({
            "type": "symbol",
            "source": 'singlePointIntoAir',
            "source-layer": "SignPoint",
            "id": 'intoAirSensorMarker',
            "layout": {
                "icon-image": {
                    "type": "categorical",
                    "property": "carid",
                    "stops": [
                        // "temperature" is 0   -> circle color will be blue
                        ["10001", 'shihua-abs'],
                        ['10002', 'shihua-abs'],
                        ['10003', 'shihua-abs']
                    ]
                },
                "icon-offset": iconOffset,
                "icon-allow-overlap": true,
                "icon-ignore-placement": true,
                "symbol-avoid-edges": false
            },
            "paint": {
                "render-road-mark": true,
                "render-3d": true,
                "symbol-height-offset": 0,
                "static-up": false,
                "run-into-air": true,  //上天代码
                "run-air-offset": 0    //第一个图标
            },
            'minzoom': 17,
            filter: ["in", 'raise', 1, 2]

        });
        //上天marker2
        map.addLayer({
            "type": "symbol",
            "source": 'singlePointIntoAir',
            "source-layer": "SignPoint",
            "id": 'intoAirSensorMarker1',
            "layout": {
                "icon-image": {
                    "type": "categorical",
                    "property": "carid",
                    "stops": [
                        // "temperature" is 0   -> circle color will be blue
                        ["10001", 'shihua-speed'],
                        ['10002', 'shihua-speed'],
                        ['10003', 'shihua-speed']
                    ]
                },
                "icon-offset": iconOffset,
                "icon-allow-overlap": true,
                "icon-ignore-placement": true,
                "symbol-avoid-edges": false
            },
            "paint": {
                "render-road-mark": true,
                "render-3d": true,
                "symbol-height-offset": 0,
                "static-up": false,
                "run-into-air": true,  //上天代码
                "run-air-offset": 100    //第一个图标
            },
            'minzoom': 17,
            filter: ["in", 'raise', 1, 2]

        });

        //我的静态上天marker
        //上天marker1
        map.addLayer({
            "type": "symbol",
            "source": 'myEventSource',
            "id": 'intoAirSensorMarkerMy1',
            "layout": {
                "icon-image": {
                    "type": "categorical",
                    "property": "id",
                    "stops": [
                        // "temperature" is 0   -> circle color will be blue
                        ["2", 'paomao-hazard'],
                        ["3", 'shigu-airbag']
                    ]
                },
                "icon-offset": iconOffset,
                "icon-allow-overlap": true,
                "icon-ignore-placement": true,
                "symbol-avoid-edges": false
            },
            "paint": {
                "render-road-mark": true,
                "render-3d": true,
                "symbol-height-offset": 0,
                "run-into-air": true,  //上天代码
                "run-air-offset": 0    //第一个图标
            },
            'minzoom': 17,
            filter: ["==", 'type', 0]

        });
        //上天marker2
        map.addLayer({
            "type": "symbol",
            "source": 'myEventSource',
            "id": 'intoAirSensorMarker1My1',
            "layout": {
                "icon-image": {
                    "type": "categorical",
                    "property": "id",
                    "stops": [
                        // "temperature" is 0   -> circle color will be blue
                        ["2", 'paomao-door'],
                        ["3", 'shigu-abs']
                    ]
                },
                "icon-offset": iconOffset,
                "icon-allow-overlap": true,
                "icon-ignore-placement": true,
                "symbol-avoid-edges": false
            },
            "paint": {
                "render-road-mark": true,
                "render-3d": true,
                "symbol-height-offset": 0,
                "run-into-air": true,  //上天代码
                "run-air-offset": 100    //第一个图标
            },
            'minzoom': 17,
            filter: ["==", 'type', 0]

        });
    },
    addDynHistogram: function (map) {
        map.addSource("histogram", {
            "tiles": ["http://datahive.minedata.cn:48085/test/SignPolygon/{z}/{x}/{y}"],
            "type": "vector"
        });

        map.addLayer({
            "type": "histogram",
            "source": "histogram",
            "id": "histogram_3d-up",
            "source-layer": "SignPolygon",
            "layout": {},
            "paint": {
                'histogram-color': "white",
                'histogram-height': 50,
                'histogram-base': 10,
                'histogram-opacity': 0.85,
                "static-up": false,
                "run-into-air": true,
                'complex-height': 40
            },
            filter: ['in', 'carid', '10001', '10002', '10003'],
            minzoom: 17
        });

        map.addLayer({
            "type": "histogram",
            "source": "histogram",
            "id": "histogram_3d-down",
            "source-layer": "SignPolygon",
            "layout": {},
            "paint": {
                'histogram-color': "white",
                'histogram-height': 50,
                'histogram-base': 10,
                'histogram-opacity': 0.85,
                "static-up": false,
                "run-into-air": true,  //上天代码
                "run-dir-reverse": true,
                'complex-height': 40
            },
            filter: ['!in', 'carid', '10001', '10002', '10003'],
            'minzoom': 17

        });

        map.addLayer({
            "type": "histogram",
            "source": "myEventSource",
            "id": "histogram_3d-up-mystatic",
            "layout": {},
            "paint": {
                'histogram-color': "white",
                'histogram-height': 55,
                'histogram-base': 10,
                'histogram-opacity': 0.85,
                "run-into-air": true,
                'complex-height': 45
            },
            filter: ['==', 'type', 4],
            'minzoom': 17

        });
        //远景柱子
        map.addLayer({
            "type": "histogram",
            "source": "myEventSource",
            "id": "histogram_3d-down-Yuanjing0",
            "layout": {},
            "paint": {
                'histogram-color': "white",
                'histogram-height': 600,
                'histogram-base': 5,
                'histogram-opacity': 0.85,
                "run-into-air": true,
                'complex-height': 595,
                'run-step': 200
            },
            filter: ['all', ['==', 'type', 6], ['==', 'zoom', 9]],
            'minzoom': 9,
            'maxzoom': 12

        });

        map.addLayer({
            "type": "histogram",
            "source": "myEventSource",
            "id": "histogram_3d-down-Yuanjing1",
            "layout": {},
            "paint": {
                'histogram-color': "white",
                'histogram-height': 310,
                'histogram-base': 5,
                'histogram-opacity': 0.85,
                "run-into-air": true,
                'complex-height': 305,
                'run-step': 200
            },
            filter: ['all', ['==', 'type', 6], ['==', 'zoom', 12]],
            'minzoom': 12,
            'maxzoom': 15

        });

        map.addLayer({
            "type": "histogram",
            "source": "myEventSource",
            "id": "histogram_3d-down-Yuanjing2",
            "layout": {},
            "paint": {
                'histogram-color': "white",
                'histogram-height': 210,
                'histogram-base': 5,
                'histogram-opacity': 0.85,
                "run-into-air": true,
                'complex-height': 205,
                'run-step': 200
            },
            filter: ['all', ['==', 'type', 6], ['==', 'zoom', 15]],
            'minzoom': 15,
            'maxzoom': 17

        });


    },
    addBianDaoMarker: function (map) {
        map.addLayer({
            "id": "biandaoMarker",
            "type": "symbol",
            "source": "myEventSource",
            "layout": {
                //"symbol-placement": "line",
                "icon-image": "huhuai_biandaox3",
                "icon-allow-overlap": true,  //图标允许压盖
                "icon-rotation-alignment": "map"
            },
            "paint": {
                "render-3d": true,
                "render-road-mark": true,
                "symbol-height-offset": 2
            },
            filter: ["==", 'type', 5],
            'minzoom': 17
        });
    }


}

export default DynLayerManager;
